package com.example.homework01.Controller;


import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

@RestController
public class HelloController {
    //获取相应路径的值
    @GetMapping("/say")
    public  String Hello(){
        return "Hello Springboot";
    }

    //  获取1000以内的随机整数
    @GetMapping("/random")
    public int random(){
        Random r=new Random();
        return  r.nextInt(1000);
    }

//    计算平方值
    @GetMapping("/square/{number}")
    public int square(@PathVariable int number){
        return number*number;
    }
}
